package com.sise.rsc.repository;

import com.sise.rsc.entity.Courier;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CourierRepository extends JpaRepository<Courier,Integer> {


    Courier findCourierByNo(String no);

    @Query(" from Courier c where c.user.id=?1 ")
    Courier findCourierByUserId(int userId);

    @Query(" from Courier")
    List<Courier> findAllCourier();

    @Query(" from Courier where id=?1")
    Courier findCourierById(int id);

    //查找相关工作区域名字对应的所有快递员
    @Query(" from Courier c where c.workingArea.addressName like ?1 ")
    List<Courier> findCouriersByWorkingAreaAddressNameLike(String like);


}
